#include "plugin.h"
#include "commtraff_hilog.h"

static void LogPrint(int severity, const char *msg,
                        user_data_t __attribute__((unused)) * user_data) {
    /**
    #define LOG_ERR 3
    #define LOG_WARNING 4
    #define LOG_NOTICE 5
    #define LOG_INFO 6
    #define LOG_DEBUG 7
    */
    switch (severity) {
        case 3:
            LOGE("%s", msg);
            break;
        case 4:
            LOGW("%s", msg);;
            break;
        case 6:
            LOGI("%s", msg);
            break;
        case 7:
            LOGD("%s", msg);
            break;
        default:
            LOGI("commtraffhilog: %s", msg);
            break;
    }

} /* void logfile_log (int, const char *) */

void module_register(void) {
    plugin_register_log("commtraff_hilog", LogPrint, /* user_data = */ NULL);
} /* void module_register (void) */
